Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support to Generate GraphQL Schema for Local Service Variable Declaration #1704

Merged

Conversation

zetcco
Copy link
Contributor

@zetcco zetcco commented Jan 9, 2024

Purpose

Fixes: #3317

Examples

This improvement enables to generate GraphQL Schema for the following locally defined backendService service object.

import ballerina/lang.runtime;
import ballerina/graphql;

public function main() returns error? {
    // local service variable declaration
    graphql:Service backendService = service object {
        resource function get greeting() returns string {
            return "Hello, World";
        }
    };
    
    graphql:Listener serverEP = check new(4000);
    check serverEP.attach(backendService, "graphql");
    check serverEP.'start();
    runtime:registerListener(serverEP);
}

Checklist

  • Linked to an issue
  • Updated the changelog
  • Added tests
  • Updated the spec
  • Checked native-image compatibility
  • No commons package changes (if there are any, please update the GraphQL version in GraphQL tools and Ballerina dev tools)
  • No compiler package changes (if there are any, please update the GraphQL version in Ballerina dev tools)

@CLAassistant
Copy link

CLAassistant commented Jan 9, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

codecov bot commented Jan 10, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (e7e4061) 86.47% compared to head (121cb1c) 86.32%.
Report is 1 commits behind head on master.

Files Patch % Lines
...raphql/compiler/ObjectConstructorAnalysisTask.java 80.76% 2 Missing and 3 partials ⚠️
...mpiler/schema/generator/GraphqlSourceModifier.java 98.07% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1704      +/-   ##
============================================
- Coverage     86.47%   86.32%   -0.16%     
- Complexity      762      771       +9     
============================================
  Files           129      130       +1     
  Lines          9094     9153      +59     
  Branches       3563     3569       +6     
============================================
+ Hits           7864     7901      +37     
- Misses          923      948      +25     
+ Partials        307      304       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ThisaruGuruge ThisaruGuruge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we add test in the ballerina-tests module, so that we can test the runtime as well?

Copy link

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

2 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@ThisaruGuruge ThisaruGuruge merged commit edcb9b1 into ballerina-platform:master Jan 22, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate GraphQL schema for local service variable declaration
7 participants